|
![](/i/fill.gif) |
Rick [Kitty5] wrote:
> Looks so much better with a Texture on the ball - reminds me of the old
> Amiga ball demo
Hi Rick,
Yes, the texturing adds a lot. I surprised myself with how easy the
orientation macro was to write:
#macro Three_Point_Trans(T1a, T1b, T1c, T2a, T2b, T2c)
transform {
#local Y = vnormalize(T1b - T1a);
#local X = vnormalize(T1c - T1a);
#local Z = vnormalize(vcross(X, Y));
#local X = vcross(Z, Y);
#local T = Shear_Trans(X, Y, Z)
translate -T1a
transform { T inverse }
#local Y = vnormalize(T2b - T2a);
#local X = vnormalize(T2c - T2a);
#local Z = vnormalize(vcross(X, Y));
#local X = vcross(Z, Y);
Shear_Trans(X, Y, Z)
translate T2a
}
#end
The three points a,b,c define a triangle; a is the origin, b-a is the
primary orientation and abc gives a secondary orientation plane. The two
orientation axes b-a and c-a do not have to be orthogonal, just
independant so vcross(b-a,c-a) doesn't return a zero length vector.
So Three_Point_Trans(0,y,x, P0,P1,P2) gives a transform from the origin
to P0, aligns y with P1-P0 and puts the (x,y) plane in the plane of the
(P0,P1,P2) triangle.
I never actually had an Amiga; Atari 400, Acorn Electron, BBC B, various
PC types ... I wrote my first (spheres only) raytracer on my Electron,
16 colour error-diffusion dithered screen output only :-) The hardware
and software have improved immeasurably, it's a shame I still can't
produce anything artistic :-(
Bye for now,
Mike Andrews.
Post a reply to this message
|
![](/i/fill.gif) |